//
//  SetViewController.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/4.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "SetViewController.h"
#import "FPLoginViewController.h"
#import "BaseNavigationViewController.h"

@interface SetViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) BaseTableView *tableView;

@end

@implementation SetViewController

-(void)quitClicked
{
    kNSUDefaultSaveVauleAndKey(@"", @"token");
    FPLoginViewController *loginVC = [[FPLoginViewController alloc] init];
    BaseNavigationViewController *nav = [[BaseNavigationViewController alloc] initWithRootViewController:loginVC];
//    [self presentViewController:nav animated:true completion:nil];
    kKeyWindow.rootViewController = nav;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"设置";
    
    self.tableView = [[BaseTableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.rowHeight = ScreenX375(54);
    [self.view addSubview:self.tableView];
    
    OperateButton *style = [[OperateButton alloc] initWithFrame:CGRectMake(ScreenX375(13), SCREEN_HEIGHT - ScreenX375(74) - NAVIGATION_BAR_HEIGHT, ScreenX375(349), ScreenX375(44))];
    [style setTitle:@"退出登录" forState:UIControlStateNormal];
    
    [style addTarget:self action:@selector(quitClicked) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    [self.view addSubview:style];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellId = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        
        UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, ScreenX375(54) - 0.5, SCREEN_WIDTH, 0.5)];
        line.backgroundColor = LineColor;
        [cell addSubview:line];
    }
    cell.textLabel.text = indexPath.row == 0 ? @"版本更新":@"关于快印包";
    cell.textLabel.font = Kfont(14);
    cell.textLabel.textColor = REXADECIMALCOLOR(@"#333333");
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
